package com.atguigu.demo;

import java.util.concurrent.TimeUnit;

class Phone{
    public synchronized void sendMsm(){
        System.out.println("-----sendMsm");
    }

    public static synchronized void sendEmail(){
        try {
            TimeUnit.SECONDS.sleep(4);
            System.out.println("------sendEmail");
        } catch (InterruptedException e) {


        }
    }
}

public class Lock8Demo {

    public static void main(String[] args) throws InterruptedException {
        Phone phone = new Phone();
         new Thread(()->{
             Phone.sendEmail();
         }).start();
         Thread.sleep(10);
         new Thread(()->{
             phone.sendMsm();
         }).start();
    }
}
